unit Parametros;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DBTables, DB, StdCtrls, Buttons, Mask, DBCtrls, ExtCtrls;

type
  TFormParametros = class(TForm)
    Bevel1: TBevel;
    Label1: TLabel;
    Label2: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    DBEditImpressora1: TDBEdit;
    DBEditImpressora2: TDBEdit;
    DBEdit3: TDBEdit;
    ComboBoxSenha: TComboBox;
    DBEdit4: TDBEdit;
    BitBtn1: TBitBtn;
    QueryConfig: TQuery;
    QueryConfigid: TIntegerField;
    QueryConfigempresa: TStringField;
    QueryConfigempresa2: TStringField;
    QueryConfigendereco: TStringField;
    QueryConfigexpiracao: TDateTimeField;
    QueryConfigchave: TStringField;
    QueryConfigid_forma_calculo: TIntegerField;
    QueryConfigtelefone: TStringField;
    QueryConfigimpressora1: TStringField;
    QueryConfigimpressora2: TStringField;
    QueryConfigimpressora3: TStringField;
    QueryConfigtx_entrega: TFloatField;
    QueryConfigtx_entrega2: TFloatField;
    QueryConfigtx_servico: TFloatField;
    QueryConfigtx_couver: TFloatField;
    QueryConfigdt_atualizacao: TDateTimeField;
    QueryConfigsenha_movto: TStringField;
    QueryConfigid_balcao: TIntegerField;
    DataSource1: TDataSource;
    TableSistema: TTable;
    TableSistemaid: TIntegerField;
    TableSistemaempresa: TStringField;
    TableSistemaempresa2: TStringField;
    TableSistemaendereco: TStringField;
    TableSistemaexpiracao: TDateTimeField;
    TableSistemachave: TStringField;
    TableSistemaid_forma_calculo: TIntegerField;
    TableSistematelefone: TStringField;
    TableSistemaimpressora1: TStringField;
    TableSistemaimpressora2: TStringField;
    TableSistemaimpressora3: TStringField;
    TableSistematx_entrega: TFloatField;
    TableSistematx_entrega2: TFloatField;
    TableSistematx_servico: TFloatField;
    TableSistematx_couver: TFloatField;
    TableSistemadt_atualizacao: TDateTimeField;
    TableSistemasenha_movto: TStringField;
    TableSistemaid_balcao: TIntegerField;
    TableSistemasenha_operador: TIntegerField;
    procedure FormActivate(Sender: TObject);
    procedure QueryConfigtx_entregaGetText(Sender: TField;
      var Text: String; DisplayText: Boolean);
    procedure QueryConfigtx_entrega2GetText(Sender: TField;
      var Text: String; DisplayText: Boolean);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormParametros: TFormParametros;
  sql:string;

implementation

uses Principal;

{$R *.dfm}

procedure TFormParametros.FormActivate(Sender: TObject);
begin

    TableSistema.Open;

    ComboBoxSenha.ItemIndex := TableSistemasenha_operador.AsInteger;

end;

procedure TFormParametros.QueryConfigtx_entregaGetText(Sender: TField;
  var Text: String; DisplayText: Boolean);
begin
    if QueryConfig.fieldByName('tx_entrega').AsInteger <> 0 then
       Text := formatfloat('###,###,##0.00', StrToFloat(QueryConfig.fieldByName('tx_entrega').AsString))
    else
       Text := '0';
end;

procedure TFormParametros.QueryConfigtx_entrega2GetText(Sender: TField;
  var Text: String; DisplayText: Boolean);
begin
    if QueryConfig.fieldByName('tx_entrega2').AsInteger <> 0 then
       Text := formatfloat('###,###,##0.00', StrToFloat(QueryConfig.fieldByName('tx_entrega2').AsString))
    else
       Text := '0.00';
end;

procedure TFormParametros.BitBtn1Click(Sender: TObject);
begin
    TableSistema.Edit;
    TableSistemasenha_operador.AsInteger := ComboBoxSenha.ItemIndex;
    TableSistema.Post;

    FormPrincipal.vImpressora1 := DBEditImpressora1.Text;
    FormPrincipal.vImpressora2 := DBEditImpressora2.Text;
    FormPrincipal.vSenhaOperador := ComboBoxSenha.ItemIndex;

    self.close;
end;

end.
